<template>
  <div class="box">
    <div>
      <i class="el-icon-s-platform"></i>
      <p>
        <span class="title">设备总数</span><span>{{ nums.number }}</span>
      </p>
    </div>
    <div>
      <i class="el-icon-s-data"></i>
      <p>
        <span class="title">设备总金额</span><span>{{ nums.amount }}</span>
      </p>
    </div>
  </div>
</template>

<script>
export default {
  name: "NumsAnd",
  props: ["shuju"],
  data() {
    return {
      nums: { number: 0, amount: 0 },
    };
  },
  async mounted() {
    // 单独请求
    // const res = await this.$axios.get("/overview");
    // this.nums = res.data.data;
  },
  watch: {
    shuju: {
      deep: true,
      // immediate: true,
      handler(value) {
        // console.log(value);
        this.nums = value[0];
        // console.log(this.nums);
      },
    },
  },
};
</script>

<style scoped  lang="less">
.box {
  width: 100%;
  height: 80px;
  // background: aqua;
  display: flex;
  align-items: center;
  margin-top: 20px;
  div {
    height: 80px;
    margin-right: 20px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    font-size: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    &:nth-child(1) {
      width: 140px;
      color: #af84f6;
      background: #dbcbf5;
    }
    &:nth-child(2) {
      width: 200px;
      color: #87cb32;
      background: #d7ecbc;
    }
    p {
      text-align: center;
      display: flex;
      flex-flow: column;
      .title {
        font-size: 10px;
      }
    }
  }
}
</style>